package itsm.isperp.module.service.callcenter; 
 
import itsm.isperp.framework.core.context.ContextHolder;
import itsm.isperp.framework.service.BaseService;
import itsm.isperp.module.entity.callcenter.CcAgent;
import itsm.isperp.module.repository.callcenter.CcAgentMapper;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;

/**
 * 服务
 * 
 * @author lizx
 * @date 2015-01-22 16:25
 */
@Service
public class CcAgentService extends BaseService<CcAgent> {

	@Autowired
	protected CcAgentMapper ccAgentMapper;

	@Override
	public CcAgentMapper getRepository() {
		return this.ccAgentMapper;
	}
	
	public String  getAgent()
	{
	  String userName=ContextHolder.getLoginUsername();
	  String sql="select * from cc_agent where username=?";
	  JdbcTemplate jdbcTemplate = ContextHolder
	      .getSpringBean("jdbcTemplate");
	  List<Map<String,Object>> list=jdbcTemplate.queryForList(sql,new Object[]{userName});
	  String returnStr="";
	  if(list.size()>0)
	  {
	    for(Map<String,Object> m:list)
	    returnStr+=m.get("agent_number")+"|";
	  }
	  return returnStr;
	  
	}
	
	
}
